const responseHandler = () => async (ctx, next) => {
	ctx.res.success = (data = null) => {
		ctx.body = {
			code: 0,
			data,
			message: '',
		};
	};
	ctx.res.failure = (message = '未知错误', code = 1) => {
		ctx.body = {
			code,
			data: null,
			message,
		};
	};
	await next();
};

export default responseHandler;
